package com.antony.messageSever1020;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.util.ArrayList;

public class UserInfo {
	private String user;
	private ArrayList<String> msgInfo = new ArrayList<>();
	private Socket sk;
	private InputStream in;
	private BufferedReader br;
	private OutputStream out;
	private BufferedWriter bw;

	public UserInfo(String user, Socket sk) {
		this.user = user;
		this.sk = sk;
	}

	public void setStream() throws IOException {
		out = sk.getOutputStream();
		in = sk.getInputStream();
		br = new BufferedReader(new InputStreamReader(in));
		bw = new BufferedWriter(new OutputStreamWriter(out));
	}

	public void outWrite(String msg) throws IOException {
		setStream();
		bw.write(msg);
	}

	public void inRead() throws IOException {
		setStream();
		br.readLine();
	}

}
